var e = require("../@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.default = void 0, require("../@babel/runtime/helpers/Arrayincludes");

var r = require("./port.js"), o = [ "get", "post", "delete", "put", "patch" ], n = {
    getUrlCode: function(e) {
        return r.port[e];
    }, 

    get1: function(url, data = {}) {
        var parmes = {
          openid1: wx.getStorageSync('openid')
        };
        return new Promise(function (o, r) {
          wx.request({
            url: getApp().globalData.baseUrl + url,
            // url: url,
            data: {
              ...data,
              ...parmes
            },
            method: "GET",
            header: {
              'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
            },
            success: function (e) {
              o(e.data);
              if (e.data.code == -1) {
                wx.switchTab({
                  url: '/pages/index/index',
                })
              } else if (e.data.code == 0) {
                const err = e.data.msg ? e.data.msg : '出错误了';
                wx.showToast({
                  title: err,
                  icon: 'none'
                })
              }
            },
            fail: function (e) {
              wx.showToast({
                title: '网络连接异常',
                icon: 'none'
              })
            },
            complete: function () {
              wx.hideLoading()
            }
          });
        });
      },
      post1: function(url, data = {}) {
        var parmes = {
          openid1: wx.getStorageSync('openid')
        };
        return new Promise(function (o, r) {
          wx.request({
            url: getApp().globalData.baseUrl + url,
            data: {
              ...data,
              ...parmes
            },
            method: "POST",
            header: {
              'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
            },
            success: function (e) {
              o(e.data);
              if (e.data.code == -1) {
                o(e.data);
                wx.switchTab({
                  url: '/pages/index/index',
                })
              } else if (e.data.code == 0) {
                const err = e.data.msg ? e.data.msg : '出错误了';
                wx.showToast({
                  title: err,
                  icon: 'none'
                })
              }
            },
            fail: function (e) {
              wx.showToast({
                title: '网络连接异常',
                icon: 'none'
              })
            },
            complete: function () {
              wx.hideLoading()
            }
          });
        });
      }, 
    throttle: function(e, t) {
        null != t && null != t || (t = 1e3);
        var r = null;
        return function(o) {
            var n = +new Date();
            (n - r > t || !r) && (e(this, o), r = n);
        };
    }
};

exports.default = n;